Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum





Attach all files within a directory.
~August Opboosietsi 01/20/2004 08:01 PM
Applications Development 6.0.3 Windows 2000


Hi,

I have a Lotus script that detaches all atachments on a document to a directory on the C:\ Drive.


Sub Click(Source As Button)
'-- Get Front and Backend Document
Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument
Set uidoc = ws.currentdocument

Dim doc As NotesDocument
Set doc = UIDoc.document

'-- Create Session object to access Notes.ini "Directory" value
Dim Session As New NotesSession
Dim dirpath As String
dirpath = session.GetEnvironmentString( "Directory", True )

'-- Loop through all attachments in document and detach to Notes Data Directory
Dim rtitem As Variant
Set rtitem = doc.GetFirstItem( "Body" )

'-- if array of embedded objects exist then detach all attachments into the Notes Data directory
If Isarray( rtitem.EmbeddedObjects ) Then
Forall o In rtitem.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
fullpath$ = dirpath + "\Quality\" + o.source
Messagebox(fullpath$)
Call o.ExtractFile( fullpath$ )
End If
End Forall
End If
Messagebox(fullpath$)
End Sub

Is there anyway I can have a button to do the reverse? Attach all files within a directory & remove the files from the directory after they have been attached ?

Thanks in advance for your help.

Neil

Go back